using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace Framework.EventArg
{
    /// <summary>
    /// 自定义事件参数
    /// </summary>
    public class EventArg 
    {
        private List<object> values;//所有参数
        public EventArg (params object[] args)
        {
            if (args == null)
            {
                this.values = null;
                return;
            }
            this.values = new List<object>(args);
        }

        public T GetValue<T>(int index = 0)
        {
            if (this.values == null || index >= this.values.Count)
            {
                return default;
            }
            return (T)this.values[index];
        }
        public bool IsNotNull(int index = 0) { return this.values.Count > index && this.values[index] != null; }

        public int Count => values.Count;
    }

}

